package com.home.manager.utils;

import com.home.manager.common.ManagerError;
import com.home.manager.common.Response;

public class ResponseBodyBuilder {


    public static <T> Response<T> ok(T t) {
        Response<T> response = new Response<>();
        response.setCode(200);
        response.setMsg("OK");
        response.setData(t);
        return response;
    }

    public static <T> Response<T> fail(ManagerError error) {
        Response<T> response = new Response<>();
        response.setCode(error.getCode());
        response.setMsg(error.getMsg());
        return response;
    }
}
